package com.webinsky.persist.dao.catalog;

import java.util.Map;

import com.webinsky.common.utils.db.BasicSqlProvider;
import com.webinsky.common.utils.db.PageHelper;
import com.webinsky.common.utils.db.Pagnation;
import com.webinsky.common.utils.db.SQLBuilder;

public class CatalogProvider extends BasicSqlProvider {

	private String[] cols = new String[]{"id", "name", "sort", "language", "del", "create_at", "update_at"};
	
	public CatalogProvider() {
		super("catalog");
	}
	
	public String selectByPagnation(Map<String, Object> param){
		Pagnation filter = (Pagnation)param.get("filter");
		SQLBuilder sqlBuilder = getSelectBuilder(cols);
		int pageStart = filter.getPageStart();
		int pageSize = filter.getPageSize();
		String pageSQL = PageHelper.startPage(sqlBuilder.toString(), pageStart, pageSize);
		return pageSQL;
	}

}
